<div class="layui-container">
    <div class="layui-row">
        <div class="layui-col-sm12 layui-col-md12 layui-col-lg12">
			<div class="widget-head">
				<div class="widget-title a m-cf">角色列表</div>
			</div>
			<div class="widget-body layui-col-sm12 layui-col-md12 layui-col-lg12">
				<!-- 工具栏 -->
				<div class="page_toolbar">
					<div class="layui-form-item q-groups">
								<a class="layui-btn"
								   href="{:url('auth/editRole')}">
									<i class="mdi menu-icon mdi-plus"></i> 新增
								</a>
					</div>
				</div>
				<div class="layui-col-md12" >
					<table width="100%" class="layui-table">
						<thead>
						<tr>
							<th>角色ID</th>
							<th>角色名称</th>
							<th>排序</th>
							<th>添加时间</th>
							<th>操作</th>
						</tr>
						</thead>
						<tbody>
						<?php if (!empty($list)): foreach ($list as $item): ?>
							<tr>
								<td class="layer-text-middle"><?= $item['role_id'] ?></td>
								<td class="layer-text-middle">{$item['role_name']}</td>
								<td class="layer-text-middle"><?= $item['sort'] ?></td>
								<td class="layer-text-middle"><?= $item['create_time'] ?></td>
								<td class="layer-text-middle">
									<div class="tpl-table-black-operation">
									   
											<a href="<?= url('auth/editRole', ['role_id' => $item['role_id']]) ?>">
												<i class="layer-icon-pencil"></i> 编辑
											</a>
											<a href="javascript:void(0);"
											   class="item-delete tpl-table-black-operation-del"
											   data-id="<?= $item['role_id'] ?>">
												<i class="layer-icon-trash"></i> 删除
											</a>
									   
									</div>
								</td>
							</tr>
						<?php endforeach; else: ?>
							<tr>
								<td colspan="12" class="layer-text-center">暂无记录</td>
							</tr>
						<?php endif; ?>
						</tbody>
					</table>
				</div>
			</div>
        </div>
    </div>
</div>
<script>
    $(function () {

        // 删除元素
        var url = "<?= url('auth/deleteRole') ?>";
        $('.item-delete').delete('role_id', url, '删除后不可恢复，确定要删除吗？');

    });
</script>

